using Uno.Foundation;

namespace UnoWebRouterApp;

public sealed partial class MainPage : Page
{
    public MainPage()
    {
        InitializeComponent();
        Loaded += MainPage_Loaded;
    }

    private void MainPage_Loaded(object sender, RoutedEventArgs e)
    {
        string url = WebAssemblyRuntime.InvokeJS("window.location.href");
        string[] args = url.Split("#");
        if (args.Length < 2) return;
        MainTextBlock.Text = args[1] switch
        {
            "/Page1" => "Page1 WWWW",
            "/Page2" => "Page2 HHHH",
            _ => "Not Page MMMM"
        };
    }
}
